package com.lhp.smp.test01.controller;

import com.lhp.smp.test01.pojo.Menu;
import com.lhp.smp.test01.service.MenuService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "用户管理接口")
@RestController
public class MenuController {
    @Resource
    private MenuService menuService;
    @GetMapping("/menu/queryall")
    public List<Menu> queryAll(){
        return menuService.list();
    }
    @PostMapping("/menu/add")
    public String add(@RequestBody Menu menu){

        menuService.save(menu);
        return "success";
    }
    @PostMapping("/menu/update")
    public String update(@RequestBody Menu menu){
        menuService.updateById(menu);
        return "success";
    }
    @DeleteMapping("/menu/delete/{id}")
    public String delete(@PathVariable int id){
        menuService.removeById(1);
        return "success";
    }

}
